package com.wantong.voice.webrtc;

/**
 * AutomaticGainControlUtils
 *
 * @author : stan
 * @version : 1.0
 * @date :  2021/10/08 12:03
 **/
public class NoiseSuppressorUtils {
    static {
        String libPath = System.getProperty("user.dir") ;
        System.load(libPath + "/native_lib/liblegacy_ns-lib.so");
        System.out.println("load legacy_ns-lib success");
    }

    public native long nsCreate();

    public native int nsInit(long nsHandler, int frequency);

    /**
     * @param mode 0: Mild, 1: Medium , 2: Aggressive
     * @return 0 - Ok
     * -1 - Error
     */
    public native int nsSetPolicy(long nsHandler, int mode);

    public native int nsProcess(long nsHandler, float[] spframe, int num_bands, float[] outframe);

    public native int nsFree(long nsHandler);

    public native long nsxCreate();

    public native int nsxInit(long nsxHandler, int frequency);

    /**
     * @param mode 0: Mild, 1: Medium , 2: Aggressive
     * @return 0 - Ok
     * -1 - Error
     */
    public native int nsxSetPolicy(long nsxHandler, int mode);

    public native int nsxProcess(long nsxHandler, short[] speechFrame, int num_bands, short[] outframe);

    public native int nsxFree(long nsxHandler);
}
